package cn.stylefeng.guns.sys.modular.system.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.sys.modular.system.entity.BtyDingdingDayDept;
import cn.stylefeng.guns.sys.modular.system.model.params.BtyDingdingDayDeptParam;
import cn.stylefeng.guns.sys.modular.system.service.BtyDingdingDayDeptService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;


/**
 * 钉钉,最新,部门,记录控制器
 *
 * @author wjk
 * @Date 2022-05-30 17:16:47
 */
@Controller
@RequestMapping("/btyDingdingDayDept")
public class BtyDingdingDayDeptController extends BaseController {

    private String PREFIX = "/btyDingdingDayDept";

    @Autowired
    private BtyDingdingDayDeptService btyDingdingDayDeptService;

    /**
     * 跳转到主页面
     *
     * @author wjk
     * @Date 2022-05-30
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/btyDingdingDayDept.html";
    }

    /**
     * 新增页面
     *
     * @author wjk
     * @Date 2022-05-30
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/btyDingdingDayDept_add.html";
    }

    /**
     * 编辑页面
     *
     * @author wjk
     * @Date 2022-05-30
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/btyDingdingDayDept_edit.html";
    }

    /**
     * 新增接口
     *
     * @author wjk
     * @Date 2022-05-30
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(BtyDingdingDayDeptParam btyDingdingDayDeptParam) {
        this.btyDingdingDayDeptService.add(btyDingdingDayDeptParam);
        return ResponseData.success();
    }

    /**
     * 编辑接口
     *
     * @author wjk
     * @Date 2022-05-30
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(BtyDingdingDayDeptParam btyDingdingDayDeptParam) {
        this.btyDingdingDayDeptService.update(btyDingdingDayDeptParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author wjk
     * @Date 2022-05-30
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(BtyDingdingDayDeptParam btyDingdingDayDeptParam) {
        this.btyDingdingDayDeptService.delete(btyDingdingDayDeptParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author wjk
     * @Date 2022-05-30
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(BtyDingdingDayDeptParam btyDingdingDayDeptParam) {
        BtyDingdingDayDept detail = this.btyDingdingDayDeptService.getById(btyDingdingDayDeptParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author wjk
     * @Date 2022-05-30
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(BtyDingdingDayDeptParam btyDingdingDayDeptParam) {
        return this.btyDingdingDayDeptService.findPageBySpec(btyDingdingDayDeptParam);
    }


    /**
     * 开始同步半天妖部门的信息
     * 月度
     * @author
     * @Date 2022-05-31
     */
    @PostMapping("/addBtyDingdingMonthDept")
    @ResponseBody
    public ResponseData addDgdDingdingMonthDept(@RequestBody BtyDingdingDayDeptParam btyDingdingDayDeptParam) {
        Map<String,String> map = this.btyDingdingDayDeptService.addBtyDingdingMonthDept(btyDingdingDayDeptParam);
        return ResponseData.success(map);
    }






    /**
     * 检索区域
     *
     * @author
     */
    @ResponseBody
    @RequestMapping("/qyList")
    public ResponseData qyList(BtyDingdingDayDeptParam btyDingdingDayDeptParam) {
        return this.btyDingdingDayDeptService.qyList(btyDingdingDayDeptParam);
    }
}


